package com.tsd.core.utils;


import java.util.HashMap;
import java.util.Map;

/**
 * Map builder
 * 使用方法
 * MapBuilder.builder().put("type","text").put("analyzer","ik_max_word").build()
 *
 * @author Hillpool
 */
public class MapBuilder {
    public static class Builder {
        private final Map<String, Object> map = new HashMap<>();

        private Builder() {
        }

        public Builder put(String key, Object obj) {
            map.put(key, obj);
            return this;
        }

        public Map<String, Object> build() {
            return map;
        }
    }

    public static Builder builder() {
        return new Builder();
    }
}
